/*
 *  Copyright 2003 by Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
 *  
 */
/* "@(#) DDK 1.10.00.23 07-02-03 (ddk-b12)" */
/*
 *  ======== uarthw.h ========
 */

#ifndef UARTHW_
#define UARTHW_

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Index into callback function array.  This array is passed to UARTHW_open()
 * by the client of the UARTHW module.
 */
#define UARTHW_MODEM_STATUSHANDLER       0
#define UARTHW_TXEMPTY_STATUSHANDLER     1
#define UARTHW_RXFULL_STATUSHANDLER      2
#define UARTHW_LINE_STATUSHANDLER        3

/*
 *  This is the signature of the callback function that UARTHW code will call
 *  for modem status, tx empty, rx full or line status as indicated by above
 *  indexes.
 */
typedef Bool (*UARTHW_Tcallback)(Ptr arg, Int val);

/*
 *  UARTHW_Handle is an opaque pointer.  Individual implementations of UARTHW
 *  will define UARTHW_Obj differently.  UARTHW_Obj is a private structure and
 *  details are intentionally hidden.
 */
typedef struct UARTHW_Obj *UARTHW_Handle;       /* opaque pointer */


/*
 *  ======== UARTHW_enableRx ========
 *  Enable the Rx Interrupt of the UART.
 *
 */
extern void UARTHW_enableRx(UARTHW_Handle hUart);

/*
 *  ======== UARTHW_disableRx ========
 *  Disable the Rx Interrupt of the UART.
 *
 */
extern void UARTHW_disableRx(UARTHW_Handle hUart);

/* 
 *  ======== UARTHW_getModemStatus ========
 *  Returns modem status.
 */
extern Int  UARTHW_getModemStatus(UARTHW_Handle hUart, Char *pmodemStatus);

/* 
 *  ======== UARTHW_open ========
 *  Open a bi-directonal UART.
 *  UARTHW_open() returns a handle to the UART as specified by 'uartId'.
 *  UARTHW_return non-NULL on success and NULL on failure.
 *  'params' is a pointer to a implemenation specific parameters structure.
 *  'cbFxns' is an array of functions to be called on specific UART conditions
 *  (e.g., txFull, rxEmpty).
 *  'cbArg' is a parameter that will be passed to each callback function.
 */
extern UARTHW_Handle UARTHW_open(Int uartid, Ptr params, Ptr cbArg, \
        UARTHW_Tcallback *cbFxns);

/*
 *  ======== UARTHW_resetDevice ========
 *  Reset the UART associated with hUart.
 */
extern void UARTHW_resetDevice(UARTHW_Handle hUart);

/*
 *  ======== UARTHW_setBreak ========
 */
extern Int  UARTHW_setBreak(UARTHW_Handle hUart, Int breakval);

/*
 *  ======== UARTHW_setDTR ========
 */
extern Int  UARTHW_setDTR(UARTHW_Handle hUart, Int dtrval);

/*
 *  ======== UARTHW_setRTS ========
 */
extern Int  UARTHW_setRTS(UARTHW_Handle hUart, Int rtsval);

/*
 *  ======== UARTHW_txEmpty ========
 */
extern Int  UARTHW_txEmpty(UARTHW_Handle hUart);

/*
 *  ======== UARTHW_writeChar ========
 *  Write a character to the UART.
 *
 */
extern void UARTHW_writeChar(UARTHW_Handle hUart, Char c);


#ifdef __cplusplus
}
#endif /* extern "C" */

#endif /* UARTHW_ */

